package zpf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.client.RestTemplate;
import zpf.annotation.ExcludeFromComponentScan;
import zpf.config.ConfigurationInside2ScanPackage;

/**
 * @ClassName: ConsumerMovieCustomRibbonApplication
 * @Description: 电影微服务，使用定制化 Ribbon 在客户端进行负载均衡，使用 RibbonClient 不同服务不同配置策略。
 * @Autor: ZPF
 * @Date: 2021/1/13 11:20
 **/
@SpringBootApplication
@EnableEurekaClient
//@RibbonClient(name = "provider-user", configuration = ConfigurationInside2ScanPackage.class)
//@ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = ExcludeFromComponentScan.class)})
public class ConsumerMovieCustomRibbonApplication {

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerMovieCustomRibbonApplication.class, args);
        System.out.println("【电影微服务-custom Ribbon】已启动.");
    }
}